package Testing;

import DeportManage.Calculation;
import static org.junit.Assert.*;
import org.junit.*;

public class CalculationTest {
	/**
	 * Test method to calculate the final cost of collecting parcel via days
	 * days in differen ranges (0-2, 3-7, 7-14)
	 * weight < 5 kg,dimension < 1.5 
	 */
	@Test
	public void testCalculation_day(){
		double expected_a = 10;
		String message_a = "Failed for days0, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_a = new Calculation(0,3,0.3,0.3,0.3);
		double actuall_a = calculation_a.getCost();
		assertEquals(message_a, String.valueOf(expected_a), String.valueOf(actuall_a));		

		double expected_b = 10;
		String message_b = "Failed for days1, weight3, length0.3, width0.3, height0.35";
		Calculation calculation_b = new Calculation(1,3,0.3,0.3,0.3);
		double actuall_b = calculation_b.getCost();
		assertEquals(message_b, String.valueOf(expected_b), String.valueOf(actuall_b));

		double expected_c = 10;
		String message_c = "Failed for days2, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_c = new Calculation(2,3,0.3,0.3,0.3);
		double actuall_c = calculation_c.getCost();
		assertEquals(message_c, String.valueOf(expected_c), String.valueOf(actuall_c));
		
		double expected_d = 10.07;
		String message_d = "Failed for days3, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_d = new Calculation(3,3,0.3,0.3,0.3);
		double actuall_d = calculation_d.getCost();
		assertEquals(message_d, String.valueOf(expected_d), String.valueOf(actuall_d));		

		double expected_e = 10.21;
		String message_e = "Failed for days5, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_e = new Calculation(5,3,0.3,0.3,0.3);
		double actuall_e = calculation_e.getCost();
		assertEquals(message_e, String.valueOf(expected_e), String.valueOf(actuall_e));		

		double expected_f = 10.35;
		String message_f = "Failed for days7, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_f = new Calculation(7,3,0.3,0.3,0.3);
		double actuall_f = calculation_f.getCost();
		assertEquals(message_f, String.valueOf(expected_f), String.valueOf(actuall_f));

		double expected_g = 10.49;
		String message_g = "Failed for days8, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_g = new Calculation(8,3,0.3,0.3,0.3);
		double actuall_g = calculation_g.getCost();
		assertEquals(message_g, String.valueOf(expected_g), String.valueOf(actuall_g));

		double expected_h = 10.77;
		String message_h = "Failed for days10, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_h = new Calculation(10,3,0.3,0.3,0.3);
		double actuall_h = calculation_h.getCost();
		assertEquals(message_h, String.valueOf(expected_h), String.valueOf(actuall_h));

		double expected_i = 11.33;
		String message_i = "Failed for days14, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_i = new Calculation(14,3,0.3,0.3,0.3);
		double actuall_i = calculation_i.getCost();
		assertEquals(message_i, String.valueOf(expected_i), String.valueOf(actuall_i));		
	}
	
	/**
	 * Test method to calculate the final cost of collecting parcel via weight
	 * days in differen ranges (0-2, 3-7, 7-14)
	 * weight < 5 kg,dimension < 1.5 
	 */
	@Test
	public void testCalculation_weight(){
		double expected_a = 10;
		String message_a = "Failed for days1, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_a = new Calculation(1,3,0.3,0.3,0.3);
		double actuall_a = calculation_a.getCost();
		assertEquals(message_a, String.valueOf(expected_a), String.valueOf(actuall_a));		

		double expected_b = 10;
		String message_b = "Failed for days1, weight5, length0.3, width0.3, height0.35";
		Calculation calculation_b = new Calculation(1,5,0.3,0.3,0.3);
		double actuall_b = calculation_b.getCost();
		assertEquals(message_b, String.valueOf(expected_b), String.valueOf(actuall_b));

		double expected_c = 10.16;
		String message_c = "Failed for days1, weight7, length0.3, width0.3, height0.3";
		Calculation calculation_c = new Calculation(1,7,0.3,0.3,0.3);
		double actuall_c = calculation_c.getCost();
		assertEquals(message_c, String.valueOf(expected_c), String.valueOf(actuall_c));			
	}
	
	/**
	 * Test method to calculate the final cost of collecting parcel via dimension
	 * days in differen ranges (0-2, 3-7, 7-14)
	 * weight < 5 kg,dimension < 1.5 
	 */
	@Test
	public void testCalculation_demension(){
		double expected_a = 10;
		String message_a = "Failed for days1, weight3, length0.3, width0.3, height0.3";
		Calculation calculation_a = new Calculation(1,3,0.3,0.3,0.3);
		double actuall_a = calculation_a.getCost();
		assertEquals(message_a, String.valueOf(expected_a), String.valueOf(actuall_a));		

		double expected_b = 10;
		String message_b = "Failed for days1, weight3, length0.5, width0.5, height0.5";
		Calculation calculation_b = new Calculation(1,3,0.5,0.5,0.5);
		double actuall_b = calculation_b.getCost();
		assertEquals(message_b, String.valueOf(expected_b), String.valueOf(actuall_b));

		double expected_c = 10;
		String message_c = "Failed for days1, weight3, length0.7, width0.3, height0.3";
		Calculation calculation_c = new Calculation(1,3,0.7,0.3,0.3);
		double actuall_c = calculation_c.getCost();
		assertEquals(message_c, String.valueOf(expected_c), String.valueOf(actuall_c));

		double expected_f = 11.08;
		String message_f = "Failed for days1, weight3, length0.8, width0.8, height0.8";
		Calculation calculation_f = new Calculation(1,3,0.8,0.8,0.8);
		double actuall_f = calculation_f.getCost();
		assertEquals(message_f, String.valueOf(expected_f), String.valueOf(actuall_f));

		double expected_g = 11.2;
		String message_g = "Failed for days1, weight8, length0.8, width0.9, height0.8";
		Calculation calculation_g = new Calculation(1,8,0.8,0.9,0.8);
		double actuall_g = calculation_g.getCost();
		assertEquals(message_g, String.valueOf(expected_g), String.valueOf(actuall_g));
	}		
}